package com.gitee.wsl.time.chinese

import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull


/**
 * 数九测试
 *
 * @author 6tail
 */
class ShuJiuTest {
    @Test
    fun test1() {
        val solar = Solar(2020, 12, 21)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "一九", shuJiu.toString())
        assertEquals(solar.toYmd(), "一九第1天", shuJiu!!.toFullString())
    }

    @Test
    fun test2() {
        val solar = Solar(2020, 12, 22)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "一九", shuJiu.toString())
        assertEquals(solar.toYmd(), "一九第2天", shuJiu!!.toFullString())
    }

    @Test
    fun test3() {
        val solar = Solar(2020, 1, 7)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "二九", shuJiu.toString())
        assertEquals(solar.toYmd(), "二九第8天", shuJiu!!.toFullString())
    }

    @Test
    fun test4() {
        val solar = Solar(2021, 1, 6)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "二九", shuJiu.toString())
        assertEquals(solar.toYmd(), "二九第8天", shuJiu!!.toFullString())
    }

    @Test
    fun test5() {
        val solar = Solar(2021, 1, 8)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "三九", shuJiu.toString())
        assertEquals(solar.toYmd(), "三九第1天", shuJiu!!.toFullString())
    }

    @Test
    fun test6() {
        val solar = Solar(2021, 3, 5)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertEquals(solar.toYmd(), "九九", shuJiu.toString())
        assertEquals(solar.toYmd(), "九九第3天", shuJiu!!.toFullString())
    }

    @Test
    fun test7() {
        val solar = Solar(2021, 7, 5)
        val lunar = solar.lunar
        val shuJiu = lunar.shuJiu
        assertNull(solar.toYmd(), shuJiu?.toFullString())
    }
}
